<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head> 
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:message style="color: red" for="form"></h:message>
        <h:form enctype="multipart/form-data" id="form">
            <h:dataTable value="#{courseofferingBean.courseofferingClasses}" var="courseoffering">
                <h:column>
                    <f:facet name="header">CIC Report</f:facet>
                    <h:form enctype="multipart/form-data">
                        <h:inputFile value="#{courseoffering.cICReportPart}" />
                        <h:commandButton value="Upload" disabled="#{courseoffering.isInstructor or courseoffering.isCourseCoordinator or courseoffering.isAltCoursecoordinator}" />
                    </h:form>
                </h:column>
                <h:column>
                    <f:facet name="header">Course Coordinator Report</f:facet>
                    <h:form enctype="multipart/form-data">
                        <h:inputFile value="#{courseoffering.courseCoordinatorReportPart}"  />
                        <h:commandButton value="Upload" disabled="#{courseoffering.isInstructor}" />
                    </h:form>
                </h:column>
                <h:column>
                    <f:facet name="header">End Of Semester Report</f:facet>
                    <h:form enctype="multipart/form-data">
                        <h:inputFile value="#{courseoffering.endOfSemesterReportPart}" />
                        <h:commandButton value="Upload" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}" />
                    </h:form>
                </h:column>
                <h:column>
                    <f:facet name="header">Lecture Notes</f:facet>
                    <h:form enctype="multipart/form-data">
                        <h:inputFile value="#{courseoffering.lecturePart}" />
                        <h:commandButton value="Upload" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}" />
                    </h:form>
                </h:column>
                <h:column>
                    <f:facet name="header">Schedule</f:facet>
                    <h:form enctype="multipart/form-data">
                        <h:inputFile value="#{courseoffering.schedulePart}" />
                        <h:commandButton value="Upload" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}" />
                    </h:form>
                </h:column>
                <h:column>
                    <f:facet name="header">Syllabus</f:facet>
                    <h:form enctype="multipart/form-data">
                        <h:inputFile value="#{courseoffering.syllabusPart}"  />
                        <h:commandButton value="Upload" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}" />
                    </h:form>
                </h:column>
                <h:column>
                    <f:facet name="header">Course</f:facet>
                    <h:inputText value="#{courseoffering.course}" required="true" disabled="true"/>
                </h:column>
                <h:column>
                    <f:facet name="header">Section</f:facet>
                    <h:inputText value="#{courseoffering.section}" required="true" disabled="true" >
                        <f:convertNumber integerOnly="true"></f:convertNumber>
                    </h:inputText>
                </h:column>
                <h:column>
                    <f:facet name="header">Semester</f:facet>
                    <h:inputText value="#{courseoffering.semester}" required="true" disabled="true" />
                </h:column>
                <h:column>
                    <f:facet name="header">Instructor</f:facet>
                    <h:inputText  required="true" value="#{courseoffering.instructor}" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">Course Outcome Attainment Target</f:facet>
                    <h:inputText  required="true" value="#{courseoffering.courseOutcomeAttainmentTarget}" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">Assignments</f:facet>
                    <h:selectManyCheckbox value="#{courseoffering.ownAssignments}" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}">
                        <f:selectItems value="#{courseoffering.allAssignments}" var="assign"
                                       itemLabel="#{assign}" />
                    </h:selectManyCheckbox>
                </h:column>
                <h:column>
                    <f:facet name="header">Course Outcome Direct Assessments</f:facet>
                    <h:selectManyCheckbox value="#{courseoffering.ownCourseOutcomeDirectAssessments}" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}">
                        <f:selectItems value="#{courseoffering.allCourseOutcomeDirectAssessments}" var="coda"
                                       itemLabel="#{coda}" />
                    </h:selectManyCheckbox>
                </h:column>
                <h:column>
                    <f:facet name="header">Course Outcome Survey Results</f:facet>
                    <h:selectManyCheckbox value="#{courseoffering.ownCourseOutcomeSurveyResults}" disabled="#{(courseoffering.isCourseCoordinator and not courseoffering.isInstructor) or courseoffering.isAltCoursecoordinator}">
                        <f:selectItems value="#{courseoffering.allCourseOutcomeSurveyResults}" var="cosa"
                                       itemLabel="#{cosa}"/>
                    </h:selectManyCheckbox>
                </h:column>
            </h:dataTable>
            <h:commandButton id='submit' value="Submit" action="#{courseofferingBean.saveCourseOffering()}" />
        </h:form>
    </h:body>
</html>

